Skip to content

fix(elements): Fallback sign-in factors to empty array - #3647

Merged
LauraBeatris merged 1 commit into
mainfrom
fix-elements-choose-strategy
Jul 1, 2024
Merged

fix(elements): Fallback sign-in factors to empty array#3647
LauraBeatris merged 1 commit into
mainfrom
fix-elements-choose-strategy

Conversation

@LauraBeatris

Copy link
Copy Markdown
Contributor

Description

Fixes scenario where sign-in factors get returned as empty values, therefore breaking iteration on choose-strategy component.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@LauraBeatris
LauraBeatris requested review from brkalow and tmilewski July 1, 2024 18:45
@LauraBeatris LauraBeatris self-assigned this Jul 1, 2024
@changeset-bot

changeset-bot Bot commented Jul 1, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d2c62f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/elements Patch
@clerk/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tmilewski tmilewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

@LauraBeatris
LauraBeatris enabled auto-merge (squash) July 1, 2024 18:47
const supportedFirstFactors = snapshot.context.clerk.client.signIn.supportedFirstFactors;
const supportedSecondFactors = snapshot.context.clerk.client.signIn.supportedSecondFactors;
const factor = [...supportedFirstFactors, ...supportedSecondFactors].find(factor => name === factor.strategy);
const factor = [...(supportedFirstFactors ?? []), ...(supportedSecondFactors ?? [])].find(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can move the fallback value to the declarations above 👀

@LauraBeatris
LauraBeatris merged commit 0565d54 into main Jul 1, 2024
@LauraBeatris
LauraBeatris deleted the fix-elements-choose-strategy branch July 1, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants